/**
 * 
 */
package fr.sportsurbains.tools;

/**
 * @author jshi
 *
 */
import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
  
public class DBHelper extends SQLiteOpenHelper {  
  
    private static final String DATABASE_NAME = "sportsurbains.db";  
    private static final int DATABASE_VERSION = 1;  
      
    public DBHelper(Context context) {  
        super(context, DATABASE_NAME, null, DATABASE_VERSION);  
    }  
  
    @Override  
    public void onCreate(SQLiteDatabase db) {  
    	/*String[] categories = MainActivity.CATEGORIES;
    	for(int i = 0; i < categories.length; i++) {
    		if(categories[i].equals("info-en-continu")||categories[i].equals("video")){
    			db.execSQL("CREATE TABLE IF NOT EXISTS "+TextUtils.join("_", categories[i].split("-"))+  
    	                "(_id INTEGER PRIMARY KEY AUTOINCREMENT, title TEXT, summary TEXT,image TEXT, link TEXT)");
    		} else {
    			db.execSQL("CREATE TABLE IF NOT EXISTS "+TextUtils.join("_", categories[i].split("-")) +  
                        "(_id VARCHAR(100) PRIMARY KEY, title TEXT, summary TEXT,image TEXT, date TEXT, link TEXT)");	
    		}
    		
    	}*/
        db.execSQL("CREATE TABLE IF NOT EXISTS images" +  
                "(_id INTEGER PRIMARY KEY AUTOINCREMENT, link TEXT, bitmap BLOB)");
        
    }  
  
    @Override  
    public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {  
    }  
}  
